#ifndef ITINERARY_H
#define ITINERARY_H

#include <QWidget>
#include <QDialog>
#include <QProgressBar>
#include <QMessageBox>
#include <QTime>
#include "dialog_adress_manager.h"
#include "parcours.h"
#include "adress.h"

namespace Ui {
    class Itinerary;
}

enum Transport_Mode
{
    DIRECT, WALK, AUTO
};

class Itinerary : public QWidget
{
    Q_OBJECT

public:
    explicit Itinerary(Dialog_Adress_Manager * Adress_Manager, QWidget *parent = 0);
    ~Itinerary();
    void set_route(QHash<int, Adress *> *route);

protected:
    void changeEvent(QEvent *e);

private:
    Ui::Itinerary *ui;
    units unit;
    Transport_Mode transport_mode;
    Dialog_Adress_Manager * Adress_Manager;
    Adress * starting;
    Adress * destination;
    Parcours * Thread_Recherche_Parcours;
    QDialog * dialog_waiting;
    QHash<int, Adress*> * route;
    void Refresh_Itinerary();
    void Revert_Step(int row, int row_to_change);
    void Remove_All_Steps();

public slots:
    void Change_Theme(QString theme_name, QString style);
    void Add_Step();
    void Modify_Step();
    void Modify_Starting();
    void Test_Starting();
    void Clear_Starting();
    void Modify_Destination();
    void Test_Destination();
    void Clear_Destination();
    void Test_Validity();
    void Cancel_Search(QString message = "");
    void Search();
    void Search_Sucess();
    void Search_Started();
    void Revert_Route();
    void Modify_Route();
    void Clear_Route();
    void Up_Step();
    void Down_Step();

    void Change_Row_Table_Steps(int currentRow);
    void Remove_Step(int Row = -1);
    void SetUnit(units u);
    void SetTransportMode(Transport_Mode mode);

signals:
    void Route_Updated();
};

#endif // ITINERARY_H
